<template>
  <form id="form1">
    <div id="container">
      <div class="content">
        <div class="news">
          <div style="background: #fff;padding: 30px;width: 800px;margin-left: auto;margin-right: auto;">
            <div class="news_select" style="display:none">
            </div>
            <div class="newsinfo">
              <div class="infotop">
                <h1>{{detail.title}}</h1>
                <ul class="to1">
                  <li class="tol3" style="padding-left: 0px;margin-right: 30px;">{{detail.createdBy}}</li>
                  <li class="tol2">{{detail.createdTime}}</li>
                </ul>
              </div>
              <div class="infobox" id="infobox">
              </div>

              <div class="pre">
                <!-- <a class="newsnext" href="http://www.gdkcsj.com/newsinfo_201_3625.html">下一篇：关于发布《广东省工程勘察诚信评估管理办法（试行）》的通知</a> -->
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </form>
</template>

<script>
import Data from '@/api/data'

export default {
  name: 'Index',
  props:{
    layout: String
  },
  data() {
    return {
      detail: {},
      query: {},
    }
  },
  watch: {
    month: {

    }

  },
  computed: {
  },
  async created() {
    var query = this.$route.query;
    this.query = query
    var content;
    if(query.type == 1) {
      var res = await Data.get("/article/" + query.id);
      if(res) {
        content = res.content
        this.detail = res
      }
    }
    if(query.type == 2) {
      var res = await Data.get("/person/" + query.id);
      if(res) {
        var imgHtml = '<p style="text-align: center;"><img src="'+res.img+'" style="height:500px;width:333px" border="0"><br></p>'
        content = imgHtml + res.info
        res.title = res.name + "（" + res.title + "）"
        this.detail = {...res}
        console.log(this.detail)
        // this.detail.title = res.name + "（" + res.title + "）"
      }
    }
    if(content) {
      var node = document.getElementById("infobox");
      node.innerHTML = content
      this.detail = {...res}
    }
  },
  methods: {
  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/new_files/bootstrap.min.css";
@import "~@/styles/new_files/iconfont.css";
@import "~@/styles/new_files/comm.css";
@import "~@/styles/new_files/info.css";
</style>
